package singletonDemo;
//饿汉模式
public class MyObject {
    private static MyObject myObject = new MyObject();
    private MyObject(){//注意这块是private构造方法私有保证了外界不能去new这个类
    }
    public static MyObject getInstance(){
        return myObject;
    }
}
